update(100) behaves slightly different than 10 times update(10) - is that a problem? [on hold]

Posted by futlib on Game Development See other posts from Game Development or by futlib
Published on 2014-08-22T04:40:25Z Indexed on 2014/08/22 10:28 UTC
Read the original article Hit count: 178

Filed under:
|
|
|

While looking into some test failures, I've identified an curious issue with my update logic.

This:

game.update(100);

Behaves slightly different from:

for (int i = 0; i < 10; i++)
    game.update(10);

The concrete example here is a rotating entity. It rotates by exactly 360 degrees in the first case, but only by about 352 in the second.

This leads to slight variations in how things move, depending on the frame rate. Not enough to be noticeable in practice, but I did notice it when writing tests.

Now my question is: Should this be fully deterministic, i.e. the outcome of update(1) * n should equal update(n) exactly? Or is it normal to have some variance and I should make my test assertions more generous?

© Game Development or respective owner

Related posts about programming

Related posts about game-loop